package com.free.show;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;

/**
 * <p>
 * Title: Eclipse Plugin Development
 * </p>
 * <p>
 * Description: Free download
 * </p>
 * <p>
 * mail: ganshm@gmail.com
 * </p>
 */

public class ComposizeExample
{
    
    /**
     * @param args
     */
    public static void main(String[] args)
    {
        // TODO Auto-generated method stub
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
        
        // 创建面板
        Composite composite1 = new Composite(shell, SWT.BORDER);
        composite1.setLayout(new RowLayout(SWT.VERTICAL));
        new Button(composite1, SWT.RADIO).setText("John"); // 单选按钮
        new Button(composite1, SWT.RADIO).setText("Paul");
        new Button(composite1, SWT.RADIO).setText("George");
        new Button(composite1, SWT.RADIO).setText("Ringo");
        
        // Create the second group
        Composite composite2 = new Composite(shell, SWT.NONE);
        composite2.setLayout(new RowLayout(SWT.VERTICAL));
        new Button(composite2, SWT.CHECK).setText("Barry"); // 勾选框
        new Button(composite2, SWT.CHECK).setText("Robin");
        new Button(composite2, SWT.CHECK).setText("Maurice");
        
        shell.setSize(200, 200);
        shell.open();
        while (!shell.isDisposed())
        {
            if (!display.readAndDispatch())
            {
                display.sleep();
            }
        }
        display.dispose();
        
    }
    
}
